from Common.BaseForm import BaseForm, IntegerField, StringField, TextAreaField, DataRequired


class ModulePostForm(BaseForm):
    pid = IntegerField('pid')
    name = StringField('name', validators=[DataRequired()])
    type = StringField('type', validators=[DataRequired()])
    icon = StringField('icon')
    url = StringField('url')
    desc = TextAreaField('desc')


class ModulePutForm(BaseForm):
    id = IntegerField('id', validators=[DataRequired()])
    pid = IntegerField('pid')
    name = StringField('name', validators=[DataRequired()])
    type = StringField('type', validators=[DataRequired()])
    icon = StringField('icon')
    url = StringField('url')
    desc = TextAreaField('desc')


class ModuleDeleteForm(BaseForm):
    id = IntegerField('id', validators=[DataRequired()])


class ActionPostForm(BaseForm):
    module_id = IntegerField('module_id')
    name = StringField('name', validators=[DataRequired()])
    mark = StringField('mark', validators=[DataRequired()])
    api = StringField('api', validators=[DataRequired()])
    method = StringField('method', validators=[DataRequired()])
    scope = StringField('scope')


class ActionPutForm(BaseForm):
    id = IntegerField('id', validators=[DataRequired()])
    module_id = IntegerField('module_id', validators=[DataRequired()])
    name = StringField('name', validators=[DataRequired()])
    mark = StringField('mark', validators=[DataRequired()])
    api = StringField('api', validators=[DataRequired()])
    method = StringField('method', validators=[DataRequired()])
    scope = StringField('scope')


class ActionDeleteForm(BaseForm):
    id = IntegerField('id', validators=[DataRequired()])
